package com.aggron.concurrency.examples.Immutable;

import com.aggron.concurrency.annotations.NotThreadSafe;
import com.aggron.concurrency.annotations.ThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * @author LR2SD
 * @description Collections.unmodifiableMap不可修改的map
 * @date 2018-06-10 16:50
 */
@ThreadSafe
@Slf4j
public class ImmutableExample2 {

    public static  Map map=new HashMap();

    static {
        map.put(1,1);
        map.put(2,3);
        map= Collections.unmodifiableMap(map);
    }
    public static void main(String [] args){
        //a=2
        //b=3
        map.put(1,2);
        log.info("{}",map.get(1));
    }

    private void test1(final int a){
        //a=2;
    }
}
